/**
 * Created by Administrator on 2017/3/23.
 */
var bob={
    name: "bob",
    friends:["a","b", "c"],

    printFriends(){
        var s = [];
        this.friends.forEach(friend => s.push(this.name + " knowns " + friend));

        return s.join("<br>");
    }
}



function Person() {
    this.name = ".dd..";
}
class Linda extends Person
{

}

function Leo() {

}
Leo.prototype = new Person();

var l1 = new Leo();
var l2 = new Leo();

var p = new Person();

var o = {};


class Dot{
    constructor(x,y){
        this.x = x;
        this.y = y;
    }
}

class Circle extends Dot{
    constructor(x,y,r){
        super(x,y);

        this.r = r;
    }

    area(){
        return 2*3.14*this.r;
    }

    static hello(){
        var x=1;
        {
            let x = 2;
        }
        console.log("Hello, world!" + x);
    }
}

Circle.hello();
var c1 = new Circle(0,0,10);
var c2 = new Circle(1,2,12);

var name = "Bob", time = "today";
var s=`Hello ${name}, how are you ${time}?`

var fibonacci1 = {
    [Symbol.iterator]() {
        let pre = 0, cur = 1;
        return {
            next() {
                [pre, cur] = [cur, pre + cur];
                return { done: false, value: cur }
            }
        }
    }
}

var fibonacci2 = {
    [Symbol.iterator]() {
        let pre = 0, cur = 1;
        return {
            next() {
                [pre, cur] = [cur, pre + cur];
                return {done:cur < 100, value: cur};
            }
        }
    }
}

for(var n in fibonacci1){
    // truncate the sequence at 1000
    if (n > 1000)
        break;
    console.log(n);
}



for (var n of fibonacci2) {
    // truncate the sequence at 1000
    if (n > 1000)
        break;
    console.log(n);
}

var x = 0;